package dialog;

import android.os.Bundle;
import android.support.annotation.NonNull;
import android.support.annotation.Nullable;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.view.Window;
import android.widget.ImageView;

import net.ck.hzq.R;

import activity.glide.GlideApp;


public class FlowRuleDialog extends BaseDialog {

    public static FlowRuleDialog newInstance(String ruleUrl) {
        FlowRuleDialog dialog = new FlowRuleDialog();
        Bundle arguments = new Bundle();
        arguments.putString("url", ruleUrl);
        dialog.setArguments(arguments);
        return dialog;
    }

    @Nullable
    @Override
    public View onCreateView(@NonNull LayoutInflater inflater, @Nullable ViewGroup container, @Nullable Bundle
            savedInstanceState) {
        if (getDialog() != null && getDialog().getWindow() != null) {
            getDialog().requestWindowFeature(Window.FEATURE_NO_TITLE);
        }
        return inflater.inflate(R.layout.dialog_flow_rule, container, false);
    }

    @Override
    public void onViewCreated(@NonNull View view, @Nullable Bundle savedInstanceState) {
        super.onViewCreated(view, savedInstanceState);
        String url = "";
        if (getArguments() != null) {
            url = getArguments().getString("url", "");
        }
        ImageView ruleIv = view.findViewById(R.id.rule_iv);
        GlideApp.with(view)
                .load(url)
                .into(ruleIv);
    }
}
